﻿#include "Settings.h"

namespace AutoPatcherAdmin
{

InIReader *const Settings::Reader = new InIReader(R"(.\PatchAdmin.ini)");
std::string Settings::Client = R"(S:\Patch\)";
std::string Settings::Host = R"(ftp://212.67.209.184/)";
std::string Settings::Login = "";
std::string Settings::Password = "";
bool Settings::AllowCleanUp = true;
bool Settings::CompressFiles = false;

    void Settings::Load()
    {
        Client = Reader->ReadString("AutoPatcher", "Client", Client);
        Host = Reader->ReadString("AutoPatcher", "Host", Host);
        Login = Reader->ReadString("AutoPatcher", "Login", Login);
        Password = Reader->ReadString("AutoPatcher", "Password", Password);

        AllowCleanUp = Reader->ReadBoolean("AutoPatcher", "AllowCleanUp", AllowCleanUp);
        CompressFiles = Reader->ReadBoolean("AutoPatcher", "CompressFiles", CompressFiles);
    }

    void Settings::Save()
    {
        Reader->Write("AutoPatcher", "Client", Client);
        Reader->Write("AutoPatcher", "Host", Host);
        Reader->Write("AutoPatcher", "Login", Login);
        Reader->Write("AutoPatcher", "Password", Password);
        Reader->Write("AutoPatcher", "AllowCleanUp", AllowCleanUp);
        Reader->Write("AutoPatcher", "CompressFiles", CompressFiles);
    }
}
